home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------------------------------
-
- FILENAME
- Collections.h
-
- DESCRIPTION
- This file contains all of the public data structures, constants, and
- function declarations for the Collection Manager.
-
- COPYRIGHT
- Copyright © Apple Computer, Inc. 1989, 1990, 1991, 1992, 1993
- All rights reserved.
-
- ------------------------------------------------------------------------------- */
-
-
- #ifndef __COLLECTIONMANAGER__
- #define __COLLECTIONMANAGER__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
-
- /*************/
- /* Constants */
- /*************/
-
-
- /* Collection Manager Gestalt Selector... */
-
- enum {
- gestaltCollectionMgrVersion = 'cltn'
- };
-
-
- /* Collection Manager Error Result Codes... */
-
- enum {
- collectionItemLockedErr = -5750,
- collectionItemNotFoundErr = -5751,
- collectionIndexRangeErr = -5752,
- collectionVersionErr = -5753
- };
-
-
- /* Convenience constants for functions which optionally return values... */
-
- enum {
- dontWantTag = 0L,
- dontWantId = 0L,
- dontWantSize = 0L,
- dontWantAttributes = 0L,
- dontWantIndex = 0L,
- dontWantData = 0L
- };
-
-
- /* attributes bits */
-
-
- enum {
- noCollectionAttributes = 0x00000000, /* no attributes bits set */
- allCollectionAttributes = 0xFFFFFFFF, /* all attributes bits set */
- userCollectionAttributes = 0x0000FFFF, /* user attributes bits */
- defaultCollectionAttributes = 0x40000000 /* default attributes - unlocked, persistent */
- };
-
-
- /*
- Attribute bits 0 through 15 (entire low word) are reserved for use by the application.
- Attribute bits 16 through 31 (entire high word) are reserved for use by the Collection Manager.
- Only bits 31 (collectionLockBit) and 30 (collectionPersistenceBit) currently have meaning.
- */
-
-
- enum {
- collectionUser0Bit = 0,
- collectionUser1Bit = 1,
- collectionUser2Bit = 2,
- collectionUser3Bit = 3,
- collectionUser4Bit = 4,
- collectionUser5Bit = 5,
- collectionUser6Bit = 6,
- collectionUser7Bit = 7,
- collectionUser8Bit = 8,
- collectionUser9Bit = 9,
- collectionUser10Bit = 10,
- collectionUser11Bit = 11,
- collectionUser12Bit = 12,
- collectionUser13Bit = 13,
- collectionUser14Bit = 14,
- collectionUser15Bit = 15,
-
- collectionReserved0Bit = 16,
- collectionReserved1Bit = 17,
- collectionReserved2Bit = 18,
- collectionReserved3Bit = 19,
- collectionReserved4Bit = 20,
- collectionReserved5Bit = 21,
- collectionReserved6Bit = 22,
- collectionReserved7Bit = 23,
- collectionReserved8Bit = 24,
- collectionReserved9Bit = 25,
- collectionReserved10Bit = 26,
- collectionReserved11Bit = 27,
- collectionReserved12Bit = 28,
- collectionReserved13Bit = 29,
-
- collectionPersistenceBit = 30,
- collectionLockBit = 31
- };
-
-
- /* attribute masks */
-
-
- enum {
- collectionUser0Mask = 1L << collectionUser0Bit,
- collectionUser1Mask = 1L << collectionUser1Bit,
- collectionUser2Mask = 1L << collectionUser2Bit,
- collectionUser3Mask = 1L << collectionUser3Bit,
- collectionUser4Mask = 1L << collectionUser4Bit,
- collectionUser5Mask = 1L << collectionUser5Bit,
- collectionUser6Mask = 1L << collectionUser6Bit,
- collectionUser7Mask = 1L << collectionUser7Bit,
- collectionUser8Mask = 1L << collectionUser8Bit,
- collectionUser9Mask = 1L << collectionUser9Bit,
- collectionUser10Mask = 1L << collectionUser10Bit,
- collectionUser11Mask = 1L << collectionUser11Bit,
- collectionUser12Mask = 1L << collectionUser12Bit,
- collectionUser13Mask = 1L << collectionUser13Bit,
- collectionUser14Mask = 1L << collectionUser14Bit,
- collectionUser15Mask = 1L << collectionUser15Bit,
-
- collectionReserved0Mask = 1L << collectionReserved0Bit,
- collectionReserved1Mask = 1L << collectionReserved1Bit,
- collectionReserved2Mask = 1L << collectionReserved2Bit,
- collectionReserved3Mask = 1L << collectionReserved3Bit,
- collectionReserved4Mask = 1L << collectionReserved4Bit,
- collectionReserved5Mask = 1L << collectionReserved5Bit,
- collectionReserved6Mask = 1L << collectionReserved6Bit,
- collectionReserved7Mask = 1L << collectionReserved7Bit,
- collectionReserved8Mask = 1L << collectionReserved8Bit,
- collectionReserved9Mask = 1L << collectionReserved9Bit,
- collectionReserved10Mask = 1L << collectionReserved10Bit,
- collectionReserved11Mask = 1L << collectionReserved11Bit,
- collectionReserved12Mask = 1L << collectionReserved12Bit,
- collectionReserved13Mask = 1L << collectionReserved13Bit,
-
- collectionPersistenceMask = 1L << collectionPersistenceBit,
- collectionLockMask = 1L << collectionLockBit
- };
-
-
-
- /* the Collection Manager trap */
-
-
- #define collectionManagerTrap 0xABF6 /* C++ will choke on an enum in a trap definition */
-
-
- /***********/
- /* Types */
- /***********/
-
-
- typedef struct PrivateCollectionRecord *Collection; /* abstract data type for a collection */
-
- typedef long CollectionTag; /* collection member 4 byte tag */
-
- #pragma procname CollectionFlatten
- typedef pascal OSErr (*CollectionFlattenProcPtr)( long size, void *data, void *refCon );
- typedef CollectionFlattenProcPtr CollectionFlattenProc;
-
- #pragma procname CollectionException
- typedef pascal OSErr (*CollectionExceptionProcPtr)( Collection c, OSErr status );
- typedef CollectionExceptionProcPtr CollectionExceptionProc;
-
-
- /**********************************************************************
- *************** Public Interfaces ***********************
- *********************************************************************/
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- pascal Collection NewCollection (void)
- = {0x7000,collectionManagerTrap};
-
-
- pascal void DisposeCollection (Collection)
- = {0x7001,collectionManagerTrap};
-
-
- pascal Collection CloneCollection (Collection)
- = {0x7002,collectionManagerTrap};
-
-
- pascal long CountCollectionOwners (Collection)
- = {0x7003,collectionManagerTrap};
-
-
- pascal Collection CopyCollection (Collection srcCollection, Collection dstCollection)
- = {0x7004,collectionManagerTrap};
-
-
- pascal long GetCollectionDefaultAttributes (Collection)
- = {0x7005,collectionManagerTrap};
-
-
- pascal void SetCollectionDefaultAttributes (Collection,
- long whichAttributes,
- long newAttributes)
- = {0x7006,collectionManagerTrap};
-
-
- pascal long CountCollectionItems (Collection)
- = {0x7007,collectionManagerTrap};
-
-
- pascal OSErr AddCollectionItem (Collection,
- CollectionTag,
- long id,
- long itemSize,
- void *itemData)
- = {0x7008,collectionManagerTrap};
-
-
- pascal OSErr GetCollectionItem (Collection,
- CollectionTag,
- long id,
- long *itemSize,
- void *itemData)
- = {0x7009,collectionManagerTrap};
-
-
- pascal OSErr RemoveCollectionItem (Collection, CollectionTag, long id)
- = {0x700A,collectionManagerTrap};
-
-
- pascal OSErr SetCollectionItemInfo (Collection,
- CollectionTag,
- long id,
- long whichAttributes,
- long newAttributes)
- = {0x700B,collectionManagerTrap};
-
-
- pascal OSErr GetCollectionItemInfo (Collection,
- CollectionTag,
- long id,
- long *index,
- long *itemSize,
- long *attributes)
- = {0x700C,collectionManagerTrap};
-
-
- pascal OSErr ReplaceIndexedCollectionItem (Collection,
- long index,
- long itemSize,
- void *itemData)
- = {0x700D,collectionManagerTrap};
-
-
- pascal OSErr GetIndexedCollectionItem (Collection,
- long index,
- long *itemSize,
- void *itemData)
- = {0x700E,collectionManagerTrap};
-
-
-
- pascal OSErr RemoveIndexedCollectionItem (Collection, long index)
- = {0x700F,collectionManagerTrap};
-
-
- pascal OSErr SetIndexedCollectionItemInfo (Collection,
- long index,
- long whichAttributes,
- long newAttributes)
- = {0x7010,collectionManagerTrap};
-
-
- pascal OSErr GetIndexedCollectionItemInfo (Collection,
- long index,
- CollectionTag *,
- long *id,
- long *itemSize,
- long *attributes)
- = {0x7011,collectionManagerTrap};
-
-
- pascal Boolean CollectionTagExists (Collection, CollectionTag)
- = {0x7012,collectionManagerTrap};
-
-
- pascal long CountCollectionTags (Collection)
- = {0x7013,collectionManagerTrap};
-
-
- pascal OSErr GetIndexedCollectionTag (Collection,
- long whichTag,
- CollectionTag *)
- = {0x7014,collectionManagerTrap};
-
-
- pascal long CountTaggedCollectionItems (Collection, CollectionTag)
- = {0x7015,collectionManagerTrap};
-
-
- pascal OSErr GetTaggedCollectionItem (Collection,
- CollectionTag,
- long whichItem,
- long *itemSize,
- void *itemData)
- = {0x7016,collectionManagerTrap};
-
-
- pascal OSErr GetTaggedCollectionItemInfo (Collection,
- CollectionTag,
- long whichItem,
- long *id,
- long *index,
- long *itemSize,
- long *attributes)
- = {0x7017,collectionManagerTrap};
-
-
- pascal void PurgeCollection (Collection,
- long whichAttributes,
- long matchingAttributes)
- = {0x7018,collectionManagerTrap};
-
-
- pascal void PurgeCollectionTag (Collection, CollectionTag)
- = {0x7019,collectionManagerTrap};
-
-
- pascal void EmptyCollection (Collection)
- = {0x701A,collectionManagerTrap};
-
-
- pascal OSErr FlattenCollection (Collection,
- CollectionFlattenProc,
- void *refCon)
- = {0x701B,collectionManagerTrap};
-
-
- pascal OSErr FlattenPartialCollection (Collection,
- CollectionFlattenProc,
- void *refCon,
- long whichAttributes,
- long matchingAttributes)
- = {0x701C,collectionManagerTrap};
-
-
- pascal OSErr UnflattenCollection (Collection,
- CollectionFlattenProc,
- void *refCon)
- = {0x701D,collectionManagerTrap};
-
-
- pascal CollectionExceptionProc GetCollectionExceptionProc (Collection)
- = {0x701E,collectionManagerTrap};
-
-
- pascal void SetCollectionExceptionProc (Collection, CollectionExceptionProc)
- = {0x701F,collectionManagerTrap};
-
-
-
- /*****************************************************************************************/
- /* Utility Routines for handle-based access... */
- /*****************************************************************************************/
-
-
-
- pascal Collection GetNewCollection (short collectionID)
- = {0x7020,collectionManagerTrap};
-
-
- pascal OSErr AddCollectionItemHdl (Collection aCollection,
- CollectionTag tag,
- long id,
- Handle itemData)
- = {0x7021,collectionManagerTrap};
-
-
- pascal OSErr GetCollectionItemHdl (Collection aCollection,
- CollectionTag tag,
- long id,
- Handle itemData)
- = {0x7022,collectionManagerTrap};
-
-
- pascal OSErr ReplaceIndexedCollectionItemHdl (Collection aCollection,
- long index,
- Handle itemData)
- = {0x7023,collectionManagerTrap};
-
-
- pascal OSErr GetIndexedCollectionItemHdl (Collection aCollection,
- long index,
- Handle itemData)
- = {0x7024,collectionManagerTrap};
-
-
- pascal OSErr FlattenCollectionToHdl (Collection aCollection, Handle flattened)
- = {0x7025,collectionManagerTrap};
-
-
- pascal OSErr UnflattenCollectionFromHdl (Collection aCollection, Handle flattened)
- = {0x7026,collectionManagerTrap};
-
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif
-